package com.yxc.live_it.fragement;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.xuexiang.xui.widget.button.roundbutton.RoundButton;
import com.yxc.live_it.R;
import com.yxc.live_it.activity.LiveEnterActivity;
import com.yxc.live_it.utils.XToastUtils;

public class LiveFragment extends Fragment implements View.OnClickListener {

    private View rootView;

    private RoundButton liveButton;

    private RoundButton orderButton;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (null == rootView) {
            rootView = inflater.inflate(R.layout.fragmen_live, container, false);
            initView(rootView);
        }
        return rootView;
    }
    /**
     * 用于初始化，具体操作视自己情况而定
     * @param rootView
     */
    private void initView(View rootView) {
        liveButton = (RoundButton)rootView.findViewById(R.id.liveBtn);
        orderButton = (RoundButton)rootView.findViewById(R.id.orderBtn);
        initOnClick();
    }

    private void initOnClick(){
        liveButton.setOnClickListener(this);
        orderButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.liveBtn:
                Intent intent = new Intent();
                intent.setClass( getActivity(), LiveEnterActivity.class);
                startActivity(intent);
                break;
            case R.id.orderBtn:
                XToastUtils.toast("预定直播");
                break;
        }
    }
}
